package ying;

import jakarta.servlet.*;

import java.io.IOException;

/**
 * ClassName: ServletDemo01
 * Package: ying
 * Description:
 *
 * @Author 刘英杰
 * @Create 2024/9/3 19:08
 * @Version 1.0
 */
public class ServletDemo01 implements Servlet {

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    /**
     * 用于处理服务端发过来的请求
     * @param servletRequest 处理客户端请求
     * @param servletResponse 对客户端响应
     * @throws ServletException
     * @throws IOException
     */
    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("Hello Servlet");
        servletResponse.getWriter().write("<font color='red'>Hello  Servlet<font>");
    }

    @Override
    public String getServletInfo() {
        return "";
    }

    @Override
    public void destroy() {

    }
}
